package cn.tedu.csmall.product.preload;

import cn.tedu.csmall.product.service.IBrandService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class CachePreload implements ApplicationRunner {

    @Autowired
    IBrandService brandService;

    public CachePreload() {
        log.debug("创建Application接口的实现对象:CachePreload");
    }

    @Override
    public void run(ApplicationArguments args) throws  Exception {
        log.debug("开始处理缓存预热");
        brandService.rebuildCache();
    }
}
